Skip to content

Add Data{N} type, undef constructors, and data/block indexing#150

Merged
mtfishman merged 12 commits into
mainfrom
mf/constructors-data-indexing
Apr 11, 2026
Merged

Add Data{N} type, undef constructors, and data/block indexing#150
mtfishman merged 12 commits into
mainfrom
mf/constructors-data-indexing

Conversation

@mtfishman
Copy link
Copy Markdown
Member

Summary

  • Add Data{N} indexing type for raw block data access without sector wrappers, with Block/Data conversions
  • Add undef constructors for SectorMatrix and FusedGradedMatrix using similar(D, axes) pattern
  • Add Data view/getindex/setindex! on FusedGradedMatrix and AbelianGradedArray, and Block setindex! on FusedGradedMatrix
  • Restructure SectorMatrix accessors so sector/data are primitive and sectoraxes/axes are derived
  • Explicit type params in convert/similar constructors; infer elsewhere
  • Add SectorOneTo(::SectorRange, ::Base.OneTo) constructor
  • Use blockdiagindices in FusedGradedMatrix blocks accessor
  • Use similar(D, axes) instead of D(undef, ...) in existing AbelianGradedArray undef constructor

Test plan

  • All existing tests pass (991 passed, 3 pre-existing broken)
  • New test_data.jl with 20 tests for Data indexing on both types
  • New undef constructor tests in test_sectormatrix.jl and test_abelianarray.jl
  • Export test updated for Data

🤖 Generated with Claude Code

- Add `Data{N}` indexing type with `Block`/`Data` conversions
- Add `SectorMatrix` undef constructors using `similar(D, axes)`
- Add `FusedGradedMatrix` undef constructors (BlockedOneTo innermost)
- Add `Data` view/getindex/setindex! on FusedGradedMatrix and AbelianGradedArray
- Add `Block` setindex! on FusedGradedMatrix for SectorMatrix values
- Restructure SectorMatrix accessors: sector/data primitive, sectoraxes/axes derived
- Use `similar(D, axes)` instead of `D(undef, ...)` in all undef constructors
- Use explicit type params in convert/similar, infer elsewhere
- Add `SectorOneTo(::SectorRange, ::Base.OneTo)` constructor
- Use `blockdiagindices` in FusedGradedMatrix blocks accessor

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 11, 2026

Codecov Report

❌ Patch coverage is 88.04348% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.12%. Comparing base (5f2e234) to head (e977097).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/sectormatrix.jl 69.23% 4 Missing ⚠️
src/abstractgradedarray.jl 88.88% 2 Missing ⚠️
src/sectoroneto.jl 33.33% 2 Missing ⚠️
src/abeliansectorarray.jl 80.00% 1 Missing ⚠️
src/data.jl 80.00% 1 Missing ⚠️
src/gradedoneto.jl 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
+ Coverage   85.52%   86.12%   +0.60%     
==========================================
  Files          19       20       +1     
  Lines        1112     1139      +27     
==========================================
+ Hits          951      981      +30     
+ Misses        161      158       -3     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mtfishman and others added 11 commits April 11, 2026 13:09
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…, use accessor in convert

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ructor, cleanup

- Move Block/Data view/getindex/setindex! to AbstractGradedArray generic interface
- Concrete types only implement view(a, ::Block{N}) as primitive
- Add parameterized FusedGradedMatrix{T,D,S} inner constructor
- Use AbstractGradedMatrix{T} as supertype for FusedGradedMatrix
- Simplify FusedGradedMatrix undef constructor with eachblockaxis
- Add AbelianSectorArray{T,N,A,S}(::AbelianSectorDelta, data) constructor
- Use accessor in AbelianSectorArray convert
- Add Tuple(::Data), SectorOneTo(::SectorRange, ::Base.OneTo)
- Use view(m, I) .= value for Block setindex! on FusedGradedMatrix
- Clean up AbelianGradedArray undef constructor with eachblockaxis

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… interface

- Add check_mul_axes for FusedGradedMatrix
- Use blockdiagindices + view(m, Data(I)) in mul! and *
- Rewrite FusedGradedMatrix(::AbelianGradedMatrix) with undef constructor + Data indexing
- Rewrite AbelianGradedArray(::FusedGradedMatrix) with Data indexing
- Fix Array(a[bI]) → copy(view(a, Data(bI)))
- Use eachblockstoredindex in blocks (blockdiagindices depends on blocks)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ersion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…xes(a))

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman merged commit 5b0ed3a into main Apr 11, 2026
16 checks passed
@mtfishman mtfishman deleted the mf/constructors-data-indexing branch April 11, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant